package com.txx.design.principles.openclose;

/*
 * @description //TODO 设计原则一 开闭原则
 * @exception   一个软件实体如类、模块和函数应该对扩展开放、对修改关闭
 * @author tuxx
 * @date 2019/3/12 19:54
 */
public class Test {

    public static void main(String[] args) {
        ICourse javaCourse = new JavaCourse(1,344,"JAVA编程思想");
        System.out.println(javaCourse.getId()+"--->"+javaCourse.getName()+"---->"+javaCourse.getPrice());

        //在不影响
        ICourse iCourse = new JavaDiscountPrice(1,344,"JAVA编程思想");
        JavaDiscountPrice javaDiscountPrice = (JavaDiscountPrice)iCourse;
        System.out.println(javaDiscountPrice.getId()+"--->"+javaDiscountPrice.getName()
                +"---->"+javaDiscountPrice.getPrice()+"---->"+javaDiscountPrice.getOriginPrice());
    }
}
